package com.yunjinsuke.recharge.controller.api;

import lombok.Data;

import java.io.Serializable;

@Data
public class ApiResponse implements Serializable {

    private int code;
    private String msg;
    private Object data;

    public ApiResponse(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ApiResponse(int code, String msg, Object data) {
        this(code, msg);
        this.data = data;
    }

    public ApiResponse(APIEnum apiEnum) {
        this.code = apiEnum.getCode();
        this.msg = apiEnum.getMsg();
    }

    public ApiResponse(String msg) {
        this(APIEnum.OK, msg);
    }

    public ApiResponse(APIEnum apiEnum, String msg) {
        this.code = apiEnum.getCode();
        this.msg = msg;
    }

    public ApiResponse(APIEnum apiEnum, Object data) {
        this(apiEnum);
        this.data = data;
    }

    public ApiResponse(Object data) {
        this(APIEnum.OK, data);
    }
}
